/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Sik
 */
@Entity
@Table(name = "deplacement")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "Deplacement.findAll", query = "SELECT d FROM Deplacement d"),
    @NamedQuery(name = "Deplacement.findByIdDeplacement", query = "SELECT d FROM Deplacement d WHERE d.idDeplacement = :idDeplacement"),
    @NamedQuery(name = "Deplacement.findByIdSaison", query = "SELECT d FROM Deplacement d WHERE d.idSaison = :idSaison"),
    @NamedQuery(name = "Deplacement.findByDate", query = "SELECT d FROM Deplacement d WHERE d.date = :date"),
    @NamedQuery(name = "Deplacement.findByDateAjout", query = "SELECT d FROM Deplacement d WHERE d.dateAjout = :dateAjout"),
    @NamedQuery(name = "Deplacement.findByDestination", query = "SELECT d FROM Deplacement d WHERE d.destination = :destination")
})
public class Deplacement implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idDeplacement")
    private Integer idDeplacement;
    @Column(name = "idSaison")
    private Integer idSaison;
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date date;
    @Column(name = "dateAjout")
    @Temporal(TemporalType.DATE)
    private Date dateAjout;
    @Column(name = "destination")
    private String destination;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "deplacement")
    private List<Transporteur> transporteurList;
    @JoinColumn(name = "saison_idSaison", referencedColumnName = "idSaison")
    @ManyToOne(optional = false)
    private Saison saisonidSaison;
    @JoinColumn(name = "competition_idCompetition", referencedColumnName = "idCompetition")
    @ManyToOne
    private Competition competitionidCompetition;
    @JoinColumn(name = "id_responsable", referencedColumnName = "idAdherent")
    @ManyToOne(optional = false)
    private Adherent idResponsable;

    public Deplacement()
    {
    }

    public Deplacement(Integer idDeplacement)
    {
        this.idDeplacement = idDeplacement;
    }

    public Integer getIdDeplacement()
    {
        return idDeplacement;
    }

    public void setIdDeplacement(Integer idDeplacement)
    {
        this.idDeplacement = idDeplacement;
    }

    public Integer getIdSaison()
    {
        return idSaison;
    }

    public void setIdSaison(Integer idSaison)
    {
        this.idSaison = idSaison;
    }

    public Date getDate()
    {
        return date;
    }

    public void setDate(Date date)
    {
        this.date = date;
    }

    public Date getDateAjout()
    {
        return dateAjout;
    }

    public void setDateAjout(Date dateAjout)
    {
        this.dateAjout = dateAjout;
    }

    public String getDestination()
    {
        return destination;
    }

    public void setDestination(String destination)
    {
        this.destination = destination;
    }

    @XmlTransient
    public List<Transporteur> getTransporteurList()
    {
        return transporteurList;
    }

    public void setTransporteurList(List<Transporteur> transporteurList)
    {
        this.transporteurList = transporteurList;
    }

    public Saison getSaisonidSaison()
    {
        return saisonidSaison;
    }

    public void setSaisonidSaison(Saison saisonidSaison)
    {
        this.saisonidSaison = saisonidSaison;
    }

    public Competition getCompetitionidCompetition()
    {
        return competitionidCompetition;
    }

    public void setCompetitionidCompetition(Competition competitionidCompetition)
    {
        this.competitionidCompetition = competitionidCompetition;
    }

    public Adherent getIdResponsable()
    {
        return idResponsable;
    }

    public void setIdResponsable(Adherent idResponsable)
    {
        this.idResponsable = idResponsable;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idDeplacement != null ? idDeplacement.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Deplacement))
        {
            return false;
        }
        Deplacement other = (Deplacement) object;
        if ((this.idDeplacement == null && other.idDeplacement != null) || (this.idDeplacement != null && !this.idDeplacement.equals(other.idDeplacement)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "Model.Deplacement[ idDeplacement=" + idDeplacement + " ]";
    }
    
}
